﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.Web.UI.Controls;
using ZX.DBModule;
using ZX.BLL.Extend;
using ZX.EHR.Library;
using ZX.BLL;

namespace ZX.WebApp.EditWidows.OrganizationalManager
{
    public partial class AddDutyInfo : EditUIPage
    {
        private string strEntity = "", strType = "",
                       strTitle = "", strDutyTypeId = "";
        BDutyInfo bllInfo = new BDutyInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            strEntity = this.GetStringFromQueryString("entity", "E_Menu");
            string strId = this.GetStringFromQueryString("id", "");
            BaseEntity instance = ZX.Common.Globals.getEntity(strEntity) as BaseEntity;
            BaseBussnies bInstance = new BLL.Extend.BaseBussnies(instance);
            BaseEntity entity = bInstance.GetEntityById(strId) as BaseEntity;
            this.EditTemplate.Text = CreateHtml(instance, entity);

            strType = this.GetStringFromQueryString("type", "");
            if (strType == "1")  //修改
            {
                IList<V_DatDutyInfo> listInfo = bllInfo.GetDutyInfoById(new Guid(strId));
                strTitle = listInfo[0].DutyTypeName;
                this.Name.Value = listInfo[0].Name;
                this.SequenceNo.Value = listInfo[0].SequenceNo.ToString();
                this.Remark.Text = listInfo[0].Remark;
                strDutyTypeId = listInfo[0].DutyTypeId.ToString();
            }
            else //新增
            {  
                strTitle = this.GetStringFromQueryString("title", "");
                strDutyTypeId = this.GetStringFromQueryString("id", "");
            }
        }
        public string Entitys
        { get { return strEntity; } }
        public string Titles
        { get { return strTitle; } }
        public string DutyTypeIds
        { get { return strDutyTypeId; } }
        public string Type
        { get { return strType; } }
        public string Flag
        { get { return this.GetStringFromQueryString("flag",""); } }
    }
}